package tcln.gxtx.client.widget.grid.renderer.html;

import tcln.gxtx.client.widget.treegrid.AbstractTreeGrid;
import tcln.gxtx.client.widget.treegrid.model.AbstractTreeModel;

import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.Grid;

/**
 * A special renderer which just renders an empty text. This renderer is used as the most optimized renderer for empty
 * texts.
 * 
 * @param <M>
 *            Model data.
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public class EmptyHtmlGridCellRenderer<M extends AbstractTreeModel> implements HtmlGridCellRenderer<M> {
    private ColumnConfig ownerColumn;

    /**
     * @param ownerColumn
     */
    public EmptyHtmlGridCellRenderer(ColumnConfig ownerColumn) {
        this.ownerColumn = ownerColumn;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ColumnConfig getOwnerColumn() {
        return ownerColumn;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String render(M model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<M> store,
            Grid<M> grid) {
        return "";
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setOwnerTree(AbstractTreeGrid<M> ownerTree) {
        // don't need it
    }

}
